<#assign module="member"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
<link rel="stylesheet" href="${ctx}/assets/css/bootstrap-multiselect.css">
<link href="${ctx}/assets/css/fileinput.css" media="all" rel="stylesheet" type="text/css" />
<style>
.input-query-multiple{
	min-width: 300px;
    padding: 0px 0px;
    height: auto;
    margin-top: 20px;
}
</style>
</@override>
<@override name="body">

<div class="row">
	<div class="col-xs-12">
	    <div class="orders-navt col-xs-9" style="padding-left:0">
	   		<ul class="orders-nav">
	  			<li class="orders-click " style="width:90px;"><a class="tab" href="${ctx}/member/list">所有用户</a></li>
		  		<li class="orders-notclick" style="width:90px;"><a class="tab" href="${ctx}/member/elist">企业信息</a></li>
		  		<li class="orders-notclick" style="width:90px;"><a class="tab" href="${ctx}/member/gradelist">用户等级</a></li>
		  		<li class="orders-notclick" style="width:90px;"><a class="tab" href="${ctx}/member/lock">登录记录</a></li>
		  		<@shiro.hasPermission name='blacklist'>
		  			<li class="orders-notclick" style="width:80px;"><a class="tab" href="${ctx}/member/blacklist">黑名单</a></li>
		  		</@shiro.hasPermission>
		  		<@shiro.hasPermission name='phonevisit'>
		  			<li class="orders-notclick" style="width:90px;"><a class="tab" href="${ctx}/phonevisit/list">回访记录</a></li>
		  		</@shiro.hasPermission>
		  		<@shiro.isMainCompany>
				  <@shiro.hasPermission name='memberapply'>
				  	<#--
				  	<li class="orders-notclick" style="width:100px;"><a class="tab" href="${ctx}/memberapply/list">VIP申请</a></li>
				  	-->
				  </@shiro.hasPermission>
			  	</@shiro.isMainCompany>
			  	<@shiro.hasPermission name='receipt'>
			  		<li class="orders-notclick" style="width:90px;"><a class="tab" href="${ctx}/receipt/list">发票申请</a></li>
			   	</@shiro.hasPermission>
			   	<@shiro.hasPermission name='membernotice'>
			   		<li class="orders-notclick" ><a class="tab" href="${ctx}/membernotice/list">通知</a></li>
			   	</@shiro.hasPermission>
		    </ul>
		</div>
		<div class="col-xs-3" style="text-align: right;">
			<@shiro.hasPermission name='memberedit'>
			<button class="btn btn-primary importMember" style="margin-right:0px;"><span class="glyphicon glyphicon-cloud-upload"></span>&nbsp;导入</button>
			<#--<button class="btn btn-primary"  style="margin-right:0px;" onclick="window.location='${ctx}/member/addPersonal';"><b>+</b>&nbsp;添加个人客户</button>-->
                <div class="orders-navh">
                    <div class="btn-group">
                        <a href="#" data-value="20" type="button" style="height: 34px;line-height: 34px;margin-left: 30px;font-size: 14px;" class="btn btn-primary btn-xs addCar"	onclick="window.location='${ctx}/member/addPersonal';">添加个人客户</a>
                        <@jgpt>
                        <button type="button" class="btn btn-primary btn-xs dropdown-toggle" style="height: 34px;" data-toggle="dropdown" aria-expanded="false">
                            <span class="caret"></span><span class="sr-only">Toggle Dropdown</span></button>
                        <ul class="dropdown-menu" role="menu">
                            <li style="cursor:pointer;">
                                <a href="#" data-value="20"  id="upload_button" class="btn-link">上报</a>
                            </li>
                        </ul>
                        </@jgpt>
                    </div>
                </div>
			<button class="btn btn-primary btn-primary-a"  style="margin-right:0px;" onclick="window.location='${ctx}/member/addEnterprise';"><b>+</b>&nbsp;添加企业客户</button>
  			</@shiro.hasPermission>
  		</div>
	</div>
  	
</div>


<div class="modal fade" id="importMemberModal" style="margin-top: 150px;">
    <div class="modal-dialog "><!--modal-lg-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">请选择Excel文件</h4>
            </div>
            <div class="modal-body" style="height:20px;padding:10px 0 30px 0;">
                <div class="col-sm-12" style="height:40px;">
                    <a href="javascript:void()" id="downloadTemplet"  url="/assets/template/meberImportTemplat.xlsx">下载导入模板</a>
                </div>
                <div class="col-sm-12">
                </div>
                <div class = "col-sm-12">
                    <div class="form-group">
                        <input id="memberExcel" type="file" name="memberExcel" multiple class="file-loading" data-min-file-count="1" data-overwrite-initial="true"><!--data-overwrite-initial="false"  data-min-file-count="2"-->
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <!-- <button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>-->
                <!--<button type="button" class="btn  btn-default">Save changes</button>-->
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<div class="tab-content">
	<div class="container-fluid ">
  		<div class="row query-pad">
  			<div class="col-xs-10" style="padding: 0px;">
  			<@shiro.isMainCompany>
	          			<div class="col-xs-4 input-query-multiple">
	            			<span>所属公司：</span>
		            		<select class="form-control form-contb" id="companyIds" name="companyIds" multiple="multiple" required>
	                    		<#if companys??>
	                    			<#list companys as company>
	                    				<option value="${company.id}">${company.abbreviation?if_exists}</option>
	                    			</#list>
	                    		</#if>
	                    	</select>
		            	</div>
            </@shiro.isMainCompany>
        		<div class="col-xs-4 input-query">
        			<span>客户电话：</span>
        			<input type="text" class="form-control form-contb" id="phone" name="phone"  placeholder="请输入客户电话">
        		</div>
      			<div class="col-xs-4 input-query">
        			<span>客户姓名：</span>
        			<input type="text" class="form-control form-contb" id="name" name="name"  placeholder="请输入客户姓名">
        		</div>
    		</div>
    		<div class="col-xs-2"style="padding: 0px;">
    			<@shiro.hasPermission name='memberexport'>
    				<div class="input-query-bttom " >
	    				<button  id="export_button" style="margin-left:10px;" type="button" class="btn btn-primary"><i class="glyphicon glyphicon-save"></i>导出</button>
	        		</div>
    			</@shiro.hasPermission>
	        		<div class="input-query-bttom " >
	    				<button  id="searchButton"  type="button">查询</button>
	        		</div>
    		</div>
  		</div>
  		
  		<div class="choose" style="display: none;">
  			<div class="col-xs-12" style="padding: 0px;">
  				<div class="col-xs-11" style="padding: 5px;">
	                <div class="col-xs-4 input-query">
	        			<span>&emsp;车牌号：</span>
	        			<input type="text" class="form-control form-contb" id="carNumber" name="carNumber"  placeholder="请输入车牌号">
	        		</div>
	  				<div class="col-xs-4 input-query" style="text-align: center;">
	        			<span>注册时间：</span>
	        			<input type="text" class="form-control form-conthtl" id="startTime" name="startTime"  placeholder="请输入起始时间"/>
	        			<span style="width:5%">到</span>
	        			<input type="hidden"  name="endTime" />
	        			<input type="text" class="form-control form-conthtl" id="endTime" name="Time" autocomplate="off"  placeholder="请输入结束时间"/>
	        		</div>
					<div class="col-xs-4 input-query">
						<span>推荐人：</span>
						<input type="text" class="form-control form-contb" id="introduceName" name="introduceName"  placeholder="请输入推荐人公号或姓名">
					</div>
            	</div>
  			</div>
  			
        	<div class="col-xs-12" style="padding:5px; line-height:3;">
  				<div class="media-wit melect">
					<span>用户等级：</span>
					<#if grades??>
						<#list grades as grade>
							<input type="checkbox" name="gradeId" value="${grade.id} ">
				  		 	<span class="checkbox-margin">${grade.name?if_exists} </span>
						</#list> 
					</#if>
  				</div>
			</div>
			<div class="col-xs-12" style="padding:5px; line-height:3;">
				<div class="media-hit melect">
						<span>用户类型：</span>
						<input type="checkbox" name="type" value="0">
					    <span class="checkbox-margin">个人用户</span>
					    <input type="checkbox" name="type" value="1">
					    <span class="checkbox-margin">企业用户</span>
	  			</div>
  			</div>
  			<div class="col-xs-12" style="padding:5px; line-height:3;">
				<div class="media-hit melect">
						<span>是否签单：</span>
						<input type="checkbox" name="permission" value="true">
						<span class="checkbox-margin">是</span>
						<input type="checkbox" name="permission" value="false">
						<span class="checkbox-margin">否</span>
	  			</div>
  			</div>
  			<@jgpt>
  			<div class="col-xs-12" style="padding:5px; line-height:3;">
				<div class="media-hit melect">
						<span>是否已上传监管平台：</span>
						<input type="checkbox" name="isPlatform" value="1">
						<span class="checkbox-margin">已上传</span>
						<input type="checkbox" name="isPlatform" value="0">
						<span class="checkbox-margin">未上传</span>
	  			</div>
  			</div>
  			</@jgpt>
  		</div>
  		<div class="query-jiant">
			<a href="#"><img id="jiant" src="${ctx}/assets/img/jiant2.png" /></a>          			
  		</div>
  	</div>
</div>

	
<div class="tabta-content">  	
	<table class="table table-condensed table-striped">
		<tbody>
			<tr>
				<@jgpt>
                <th width="20px;">
                    <div class='checkbox checkbox-success' id="checkAll"  style='margin-top:-5px;margin-left:30px;'>
                        <input id='all' class='styled' val="false" type='checkbox' />
                        <label for="all"></label>
                    </div>
                </th>
                </@jgpt>
				<th width="100px">联系人</th>
				<@jgpt>
				<th width="100px">是否已上传</th>
				</@jgpt>
				<th>身份证</th>
				<th>企业名称</th>
				<th>客户来源</th>
				<th>手机号</th>
				<th>允许签单</th>
				<th>余额(可提现)</th>
				<th>余额(不可提现)</th>
				<@shiro.isMainCompany>
				<th>所属公司</th>
				</@shiro.isMainCompany>
				<th>等级</th>
				<th>车牌号 / 客户信息</th>
				<th>推荐人</th>
				<th>注册时间</th>
				<th>操作</th>
			</tr>
		</tbody>
	</table>
	<div style="text-align:center" id="NoData"></div>
	</br>
	<ul class="pagination pull-left pagination-sm pageshow" style="display:none;">
		<li><a></a></li>
	</ul>
	<ul class="pagination pull-left pagination-sm pagedata" style="display:none;">
    </ul>
</div>


<div class="modal fade" tabindex="-1" id="uploadMemberModal" role="dialog">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">数据校验中<span  class="loading" style="margin: -60px 0 0 -120px;"></span></h4>
            </div>
            <div class="modal-body">
                <div class="progress" id="progressDiv">
                    <div id="loadingPro" class="progress-bar progress-bar-info progress-bar-striped"
                         role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 10%">
                    </div>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</@override>

<@override name="footer">

	<script type="text/javascript">
		window.daijia = {
			ctx:'${ctx}',
			userId:'<@shiro.principal property='id'/>'
		};
		var membermoneyview=false;
		var phonevisit=false;
		var memberedit=false;
		var ismain=false;
		<@shiro.isMainCompany>
			ismain= true;
		</@shiro.isMainCompany>
		<@shiro.hasPermission name='membermoneyview'>
			membermoneyview=true;							
		</@shiro.hasPermission>
		<@shiro.hasPermission name='phonevisit'>
		    phonevisit=true;
		</@shiro.hasPermission>
		<@shiro.hasPermission name='memberedit'>
			memberedit=true;
		</@shiro.hasPermission>
	</script>
	<script src="${ctx}/assets/js/bootstrap-multiselect.js"></script>
	<script src="${ctx}/assets/js/pushmessage.js"></script>
	<script src="${ctx}/assets/js/jquery.paging.min.js"></script>
	<script src="${ctx}/assets/js/bootstrap-datetimepicker.min.js"></script>
	<script src="${ctx}/assets/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="${ctx}/assets/js/fileinput.js" type="text/javascript"></script>
<script src="${ctx}/assets/js/fileinput_locale_zh.js" type="text/javascript"></script>
	<script src="${ctx}/assets/js/member/memberlist.js"></script>
	<script type="text/javascript">
		<@jgpt>
			window.jgpt=true;
		</@jgpt>
		var thisButton;
		window.isUpPlatformInfo = '${isUpPlatformInfo?string('true', 'false')}';
		function deletePassenger() {
		    $.post('${ctx}/member/deletePassenger',{'id':thisButton.attr("data-value")},function(data){
		            if(data.success){
		                $.scojs_message('客户删除成功', $.scojs_message.TYPE_OK);
		                window.location.reload(true);
		            } else {
		                $.scojs_message(data.message, $.scojs_message.TYPE_ERROR);
		            }
		    },'json');
		}
		
		function blackMember() {
		    $.post('${ctx}/member/black',{'id':thisButton.attr("data-value")},function(data){
		            if(data.success){
		            	$.scojs_message('操作成功', $.scojs_message.TYPE_OK);
		            	window.location.reload(true);
		            } else {
		                $.scojs_message(data.message, $.scojs_message.TYPE_ERROR);
		            }
		    },'json');
		}
		
		$(document).ready(function(){
		    $(document).on("click",".deletethis",function(){
		          thisButton = $(this);
		          var confirm = $.scojs_confirm({
		            content: "您确认要删除客户信息吗？删除后客户的所有相关财务记录余额订单记录将全部清空，你也可以将客户加入黑名单，他/她将无法再下单！",
		            action:deletePassenger
		          });
		          confirm.show();
		    });
		    
		    $(document).on("click",".blackthis",function(){
		          thisButton = $(this);
		          var confirm = $.scojs_confirm({
		            content: "您确认要将该用户添加到黑名单吗",
		            action:blackMember
		          });
		          confirm.show();
		    });
		    
		});




	</script>
</@override>
<@extends name="../layout.ftl"/>
